let path = require("path");
let sequelize = require('../config/sequelize');

const modelName = path.basename(__filename, '.js');

const model = sequelize.define(modelName, {

  id: {
    type: sequelize.Sequelize.INTEGER,
    primaryKey: true,
    autoIncrement: true,
    comment: '自增ID'
  },

  username: {
    type: sequelize.Sequelize.TEXT,
    comment: '用户名'
  },

  password: {
    type: sequelize.Sequelize.STRING,
    comment: '密码'
  },

  student_id: {
    type: sequelize.Sequelize.STRING,
    comment: '学号'
  },

  session_id: {
    type: sequelize.Sequelize.STRING,
    comment: 'session id'
  },
  
  email: {
    type: sequelize.Sequelize.TEXT,
    comment: '邮箱'
  },

  email_validated: {
    type: sequelize.Sequelize.BOOLEAN,
    comment: '邮箱已验证'
  },

  photo: {
    type: sequelize.Sequelize.TEXT,
    comment: '头像'
  },

  slogan: {
    type: sequelize.Sequelize.TEXT,
    comment: '个性签名'
  },

  last_login_at: {
    type: sequelize.Sequelize.DATE,
    comment: '上次登录时间'
  },

}, {
    underscored: true,
    freezeTableName: true,
    paranoid: true
  });

module.exports = model;
